﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
using HotFixFramework;

namespace ClientExtensions
{
    public static class BundleBuilderContextMenu
    {
        private const string MenuBase = "Assets/Bundle Tools/";
        private const string MarkBundle = "Mark Bundle";
        private const string UnMarkBundle = "Unmark Bundle";
        private const string BuildMiddleware = "Build Middleware";
        private const string BuildLocal = "Build LocalBundles";
        private const string BuildAndroid = "Build AndroidBundles";
        private const string BuildIOS = "Build IOSBundles";
        private const string BuildResVariable = "Build ResVariable";

        private const int SettingsPriority = 3200;
        private const int BuildersPriority = 3300;
        private const int GenerateCode = 3400;

        [MenuItem(MenuBase + MarkBundle, false, SettingsPriority)]
        public static void MarkSelBundle()
        {
            BundleBuilder.MarkBundle();
        }

        [MenuItem(MenuBase + UnMarkBundle, false, SettingsPriority)]
        public static void UnmarkSelBundle()
        {
            BundleBuilder.UnMarkBundle();
        }

        [MenuItem(MenuBase + BuildMiddleware, false, SettingsPriority)]
        public static void BuildMiddlewareFile()
        {
            BundleBuilder.BuildMiddlewareFile();
        }

        [MenuItem(MenuBase + BuildLocal, false, BuildersPriority)]
        public static void DoBuildLocal()
        {
            BundleBuilder.BuildAssetBundles(BuildTarget.StandaloneWindows);
        }

        [MenuItem(MenuBase + BuildAndroid, false, BuildersPriority)]
        public static void DoBuildAndroid()
        {
            BundleBuilder.BuildAssetBundles(BuildTarget.Android);
        }

        [MenuItem(MenuBase + BuildIOS, false, BuildersPriority)]
        public static void DoBuildIOS()
        {
            BundleBuilder.BuildAssetBundles(BuildTarget.iOS);
        }

        [MenuItem(MenuBase + BuildResVariable, false, GenerateCode)]
        public static void BuildResVariableCode()
        {
            CodeGenerator.GeneratorResVariable();
        }
    }
}
